import os
 
a = 0
train_txt = open('train.txt','w')
val_txt = open('val.txt','w')
for i in os.listdir('******'):

    if a < ******: #train
        print('******' + i,file=train_txt,flush=True)
    else: #test
        print('******' + i,file=val_txt,flush=True)
    ******
    
    
